package com.cyandpos.pad.refund.presenter;

import android.content.Context;

import com.cyandpos.pad.posdata.BackUploadResult;
import com.cyandpos.pad.posdata.Member;
import com.cyandpos.pad.posdata.QueryMemberReq;
import com.cyandpos.pad.refund.contract.UploadRefundContract;
import com.cyandpos.pad.refund.model.UploadRefundModelImpl;


public class UploadRefundPresenterImpl implements UploadRefundContract.Presenter, UploadRefundContract.Model.OnCompleteListener,UploadRefundContract.Model.OngetVipInfoCompleteListener {
    private UploadRefundContract.View mView;
    private UploadRefundContract.Model mModel;
    private Context mContext;

    public UploadRefundPresenterImpl(Context context, UploadRefundContract.View view) {
        mContext = context;
        mView = view;
        mModel = new UploadRefundModelImpl();
    }

    @Override
    public void upLoadBackGoods() {
        mView.showProgress();
        mModel.upLoadBackGoods(mView.getTicketInfo(),this);
    }

    @Override
    public void getVipInfo(QueryMemberReq queryMemberInfoRequestParam) {
        mView.showProgress();
        mModel.getVipInfo(queryMemberInfoRequestParam,this);
    }


    @Override
    public void onSuccess(BackUploadResult result) {
        mView.dismissDialog();
        mView.onSucess(result);
    }

    @Override
    public void onFailure(String errorMsg) {
        mView.dismissDialog();
        mView.showErrMessage(errorMsg);
    }

    @Override
    public void onGetVipSuccess(Member member) {
        mView.dismissDialog();
        mView.onGetVIPsuccess(member);
    }

    @Override
    public void onGetVipFailure(String errorMsg) {
        mView.dismissDialog();
        mView.showErrMessage(errorMsg);
    }
}
